package main

import "fmt"

func main()  {
	
}

type PathTreeNode struct{
	val int
	left *PathTreeNode
	right *PathTreeNode
}

type ret struct {
	retArr [][]int
	path []int
}

func calLogic(root *PathTreeNode)  {
  s := &ret{
	  retArr: [][]int{},
	  path:   []int{},
  }
  sum := 25
  s.getSumAndPath(root,sum)
  fmt.Println(s)
}

func (s *ret) getSumAndPath(root *PathTreeNode, sum int)  {
	if root == nil {
		return
	}

	s.path = append(s.path,root.val)
	defer func(){
		s.path = s.path[0:len(s.path)-1]
	}()
	sum -= root.val
	if root.left == nil && root.right == nil && sum == 0 {
		s.retArr = append(s.retArr,s.path)
		return
	}
	s.getSumAndPath(root.left,sum)
	s.getSumAndPath(root.right,sum)
}